package com.educate.staservice.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.educate.commonutils.ResultOne;
import com.educate.staservice.entity.StatisticsDaily;
import com.educate.staservice.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author educate.wht
 * @since 2022-08-31
 */
@RestController
@RequestMapping("/staservice/sta")
@CrossOrigin
public class StatisticsDailyController {
    @Autowired
    private  StatisticsDailyService statisticsDailyService;
    //统计某一天的注册人数
    @PostMapping("registerCount/{day}")
    public ResultOne registerCount(@PathVariable String day){
        statisticsDailyService.registerCount(day);
        return ResultOne.ok();
    }
    //图像显示,返回两个部分数据,日期json数组,数量json数组
    @GetMapping("showData/{type}/{begin}/{end}")
    public ResultOne showData(@PathVariable String type,@PathVariable String begin,@PathVariable String end){
        Map<String,Object> map=statisticsDailyService.getShowData(type,begin,end);
        return ResultOne.ok().data(map);
    }


}

